package com.qf.mapper2;

import com.qf.domain2.Classes;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ClassesMapper2 {

//    @Select("select * from classes")
//    @Results({
//            @Result(property = "id",column = "id"),
//            @Result(property = "name",column = "name"),
//            @Result(property = "stus",column = "id",
//                    javaType = List.class,
//                    many = @Many(select = "com.qf.mapper2.StudentMapper2.findByCid")
//            )
//    })

    @Select("SELECT cl.id cid,cl.name cname,s.id,s.name,s.age FROM classes cl,student s WHERE cl.id=s.cid")
    @ResultMap("classesMap")
    List<Classes> findAll();

    Classes findById(Integer id);
}
